package dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;

  
  
/**
 * This class was autogenerated by Torque on:
 *
 * [Fri Jan 09 02:39:32 PST 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Zip
 */
public abstract class BaseZip extends BaseObject
{
    /** The Peer class */
    private static final ZipPeer peer =
        new ZipPeer();

        
    /** The value for the zipid field */
    private int zipid;
      
    /** The value for the zipcode field */
    private String zipcode;
      
    /** The value for the townname field */
    private String townname;
      
    /** The value for the provinceid field */
    private int provinceid;
  
    
    /**
     * Get the Zipid
     *
     * @return int
     */
    public int getZipid()
    {
        return zipid;
    }

                                              
    /**
     * Set the value of Zipid
     *
     * @param v new value
     */
    public void setZipid(int v) throws TorqueException
    {
    
                  if (this.zipid != v)
              {
            this.zipid = v;
            setModified(true);
        }
    
          
                                  
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddresszipid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddresszipid.get(i))
                    .setResidentialaddresszipid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddresszipid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddresszipid.get(i))
                    .setCollegeaddresszipid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddresszipid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddresszipid.get(i))
                    .setGuardianaddresszipid(v);
            }
        }
                      }
  
    /**
     * Get the Zipcode
     *
     * @return String
     */
    public String getZipcode()
    {
        return zipcode;
    }

                        
    /**
     * Set the value of Zipcode
     *
     * @param v new value
     */
    public void setZipcode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.zipcode, v))
              {
            this.zipcode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Townname
     *
     * @return String
     */
    public String getTownname()
    {
        return townname;
    }

                        
    /**
     * Set the value of Townname
     *
     * @param v new value
     */
    public void setTownname(String v) 
    {
    
                  if (!ObjectUtils.equals(this.townname, v))
              {
            this.townname = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Provinceid
     *
     * @return int
     */
    public int getProvinceid()
    {
        return provinceid;
    }

                              
    /**
     * Set the value of Provinceid
     *
     * @param v new value
     */
    public void setProvinceid(int v) throws TorqueException
    {
    
                  if (this.provinceid != v)
              {
            this.provinceid = v;
            setModified(true);
        }
    
                          
                if (aProvince != null && !(aProvince.getProvinceid() == v))
                {
            aProvince = null;
        }
      
              }
  
      
    
                  
    
        private Province aProvince;

    /**
     * Declares an association between this object and a Province object
     *
     * @param v Province
     * @throws TorqueException
     */
    public void setProvince(Province v) throws TorqueException
    {
            if (v == null)
        {
                    setProvinceid(0);
                  }
        else
        {
            setProvinceid(v.getProvinceid());
        }
                aProvince = v;
    }

                                            
    /**
     * Get the associated Province object
     *
     * @return the associated Province object
     * @throws TorqueException
     */
    public Province getProvince() throws TorqueException
    {
        if (aProvince == null && (this.provinceid > 0))
        {
                          aProvince = ProvincePeer.retrieveByPK(SimpleKey.keyFor(this.provinceid));
              
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Province obj = ProvincePeer.retrieveByPK(this.provinceid);
               obj.addZips(this);
            */
        }
        return aProvince;
    }

    /**
     * Provides convenient way to set a relationship based on a
     * ObjectKey.  e.g.
     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
     *
           */
    public void setProvinceKey(ObjectKey key) throws TorqueException
    {
      
                        setProvinceid(((NumberKey) key).intValue());
                  }
       
                                        
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByResidentialaddresszipid
     */
    protected List collStudentPersonalInformationsRelatedByResidentialaddresszipid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByResidentialaddresszipid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByResidentialaddresszipid()
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByResidentialaddresszipid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByResidentialaddresszipid().add(l);
        l.setZipRelatedByResidentialaddresszipid((Zip) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByResidentialaddresszipid
     */
    private Criteria lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddresszipid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresszipid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresszipid = getStudentPersonalInformationsRelatedByResidentialaddresszipid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresszipid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid() );
                      collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                      if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddresszipid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresszipid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresszipid = getStudentPersonalInformationsRelatedByResidentialaddresszipid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresszipid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                       collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                       if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresszipidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresszipid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByCollegeaddresszipid
     */
    protected List collStudentPersonalInformationsRelatedByCollegeaddresszipid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByCollegeaddresszipid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByCollegeaddresszipid()
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByCollegeaddresszipid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByCollegeaddresszipid().add(l);
        l.setZipRelatedByCollegeaddresszipid((Zip) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByCollegeaddresszipid
     */
    private Criteria lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddresszipid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresszipid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresszipid = getStudentPersonalInformationsRelatedByCollegeaddresszipid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresszipid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid() );
                      collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                      if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddresszipid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresszipid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresszipid = getStudentPersonalInformationsRelatedByCollegeaddresszipid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresszipid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                       collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                       if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresszipidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresszipid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByGuardianaddresszipid
     */
    protected List collStudentPersonalInformationsRelatedByGuardianaddresszipid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByGuardianaddresszipid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByGuardianaddresszipid()
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByGuardianaddresszipid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByGuardianaddresszipid().add(l);
        l.setZipRelatedByGuardianaddresszipid((Zip) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByGuardianaddresszipid
     */
    private Criteria lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddresszipid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresszipid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresszipid = getStudentPersonalInformationsRelatedByGuardianaddresszipid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresszipid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid() );
                      collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                      if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddresszipid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresszipid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresszipid = getStudentPersonalInformationsRelatedByGuardianaddresszipid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     * If this Zip is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresszipid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                       collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                       if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Zip is new, it will return
     * an empty collection; or if this Zip has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresszipid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Zip.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresszipidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresszipid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresszipid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                            collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSZIPID, getZipid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresszipid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresszipidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresszipid;
    }
                            


          
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("Zipid");
              fieldNames.add("Zipcode");
              fieldNames.add("Townname");
              fieldNames.add("Provinceid");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("Zipid"))
        {
                return new Integer(getZipid());
            }
          if (name.equals("Zipcode"))
        {
                return getZipcode();
            }
          if (name.equals("Townname"))
        {
                return getTownname();
            }
          if (name.equals("Provinceid"))
        {
                return new Integer(getProvinceid());
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(ZipPeer.ZIPID))
        {
                return new Integer(getZipid());
            }
          if (name.equals(ZipPeer.ZIPCODE))
        {
                return getZipcode();
            }
          if (name.equals(ZipPeer.TOWNNAME))
        {
                return getTownname();
            }
          if (name.equals(ZipPeer.PROVINCEID))
        {
                return new Integer(getProvinceid());
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getZipid());
            }
              if (pos == 1)
        {
                return getZipcode();
            }
              if (pos == 2)
        {
                return getTownname();
            }
              if (pos == 3)
        {
                return new Integer(getProvinceid());
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(ZipPeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    ZipPeer.doInsert((Zip) this, con);
                    setNew(false);
                }
                else
                {
                    ZipPeer.doUpdate((Zip) this, con);
                }
            }

                                                
                
            if (collStudentPersonalInformationsRelatedByResidentialaddresszipid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddresszipid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddresszipid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByCollegeaddresszipid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddresszipid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddresszipid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByGuardianaddresszipid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddresszipid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddresszipid.get(i)).save(con);
                }
            }
                          alreadyInSave = false;
        }
      }


                          
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  zipid ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setZipid(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setZipid(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getZipid());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Zip copy() throws TorqueException
    {
        return copyInto(new Zip());
    }
  
    protected Zip copyInto(Zip copyObj) throws TorqueException
    {
          copyObj.setZipid(zipid);
          copyObj.setZipcode(zipcode);
          copyObj.setTownname(townname);
          copyObj.setProvinceid(provinceid);
  
                    copyObj.setZipid(0);
                              
                                                
                
        List v = getStudentPersonalInformationsRelatedByResidentialaddresszipid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByResidentialaddresszipid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByCollegeaddresszipid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByCollegeaddresszipid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByGuardianaddresszipid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByGuardianaddresszipid(obj.copy());
        }
                    
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public ZipPeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Zip:\n");
        str.append("Zipid = ")
           .append(getZipid())
           .append("\n");
        str.append("Zipcode = ")
           .append(getZipcode())
           .append("\n");
        str.append("Townname = ")
           .append(getTownname())
           .append("\n");
        str.append("Provinceid = ")
           .append(getProvinceid())
           .append("\n");
        return(str.toString());
    }
}
